package com.cinc.ebc.mm.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.cinc.ebc.mm.entity.MmPurchaseOrder;
import com.cinc.ebc.mm.entity.MmPurchaseOrderDetail;
import com.cinc.ebc.mm.model.*;
import com.cinc.ebc.mm.vo.MmPurchaseOrderDetailPage;
import com.cinc.ebc.mm.vo.MmRptPurOrderStatPage;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * @Description: 采购订单
 * @Author: jeecg-boot
 * @Date:   2022-03-20
 * @Version: V1.0
 */
public interface IMmPurchaseOrderService extends IService<MmPurchaseOrder> {

	/**
	 * 添加一对多
	 *
	 */
	public void saveMain(MmPurchaseOrder mmPurchaseOrder,List<MmPurchaseOrderDetail> mmPurchaseOrderDetailList) ;

	/**
	 * 修改一对多
	 *
	 */
	public void updateMain(MmPurchaseOrder mmPurchaseOrder,List<MmPurchaseOrderDetail> mmPurchaseOrderDetailList) throws Exception;

	/**
	 * 删除一对多
	 */
	public void delMain (String id);

	/**
	 * 批量删除一对多
	 */
	public void delBatchMain (List<String> idList);

    IPage<MmPurchaseOrderDetailModel> detailPage(Page<MmPurchaseOrderDetailModel> page, MmPurchaseOrderDetailPage mmPurchaseOrderDetailPage);

    List<MmPurchaseOrderDetailModel> detailList(MmPurchaseOrderDetailPage mmPurchaseOrderDetailPage);

	/**
	 * 删除明细
	 *
	 * @param id
	 * @return void
	 * @throws
	 */
	void delDetail(String id) throws Exception;

	void delBatchDetail(List<String> idList) throws Exception;

    void delLogicMain(String id) throws RuntimeException;

	/**
	 * 采购统计查询
	 * @param page
	 * @param mmRptPurOrderStatPage
	 * @return
	 */
    IPage<MmRptPurOrderMaterialStatModel> queryRptMaterialStatList(Page<MmRptPurOrderMaterialStatModel> page, MmRptPurOrderStatPage mmRptPurOrderStatPage);

	MmRptPurOrderMaterialStatTotalModel queryRptMaterialStatTotal(MmRptPurOrderStatPage mmRptPurOrderStatPage);

    IPage<MmRptPurOrderSupplyStatModel> queryRptSupplyStatList(Page<MmRptPurOrderSupplyStatModel> page, MmRptPurOrderStatPage mmRptPurOrderStatPage);

	MmRptPurOrderSupplyStatTotalModel queryRptSupplyStatTotal(MmRptPurOrderStatPage mmRptPurOrderStatPage);

	IPage<MmRptPurOrderBuyerStatModel> queryRptBuyerStatList(Page<MmRptPurOrderBuyerStatModel> page, MmRptPurOrderStatPage mmRptPurOrderStatPage);

	MmRptPurOrderBuyerStatTotalModel queryRptBuyerStatTotal(MmRptPurOrderStatPage mmRptPurOrderStatPage);

    Map<String, BigDecimal> queryLatestPrice(String materialIds, String supplyId);

    void querySupplyMaterialStatPageList(Page<MmPurchaseOrderSupplyMaterialModel> page, MmPurchaseOrderDetailPage detailPage);
}
